#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
#include <string.h>
char a[1000];
int judge(int i, int j)
{
	while (i <= j)
		if (a[i++] != a[j--])
			return 0;
	return 1;
}

int main()
{
	gets(a);
	int max = 0;
	int len = strlen(a);

	for (int i = 0; i < len; i++)
		for (int j = len - 1; j >= i; j--)
			if (judge(i, j))
				max = max > (j - i + 1) ? max : (j - i + 1);

	printf("%d", max);
	return 0;
}